// import animate from 'animate.css' 
import "@/assets/css/reset.css"
import "@/common/http";
// import "../assets/layui/css/layui.css"
// import "../assets/layui/layui"
import Vue from 'vue'
import router from '@/router/index'
import * as api from "@/common/api"
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
Vue.use(VueAwesomeSwiper)
import ElementUI from 'element-ui';
import '../assets/css/element-variables.scss'
// import 'element-ui/lib/theme-chalk/index.css';
import { HappyScroll } from 'vue-happy-scroll'
// 自定义组件名
Vue.component('happy-scroll', HappyScroll)
// 引入css
import 'vue-happy-scroll/docs/happy-scroll.css'

Vue.use(ElementUI);

import "@/assets/css/animate.min.css"
import "@/common/http"
Vue.prototype.$http=api


router.beforeEach((to, from, next) => {
    // if(to.path!="/login"){
    //         if(!sessionStorage.getItem("token")){
    //             next("/login")
    //             return 
    //         }else{
    //         next() 
    //         }
    // }
    next()
    // if (to.path === '/login') return next()
    // // 获取token
    // const tokenStr = window.sessionStorage.getItem('token')
    // if (!tokenStr) return next('/login')
    // next()
  })
  // 阻止用户多次点击
Vue.directive('noClick', {
  inserted(el, binding) {
    el.addEventListener('click', e => {
      el.classList.add('is-disabled');
      el.disabled = true;
      setTimeout(() => {
        el.disabled = false;
        el.classList.remove('is-disabled');
      }, binding.value || 1000)
    })
  }
});
